<p>There is no good excuse for an empty class. If it’s being used simply as a common extension point, it should be replaced with an
<code>interface</code>. If it was stubbed in as a placeholder for future development it should be fleshed-out. In any other case, it should be
eliminated.</p>
<p>Additionally, one shouldn’t use a class to define exclusively static methods. Instead one can use a module, or better, export each function
separately.</p>
<h2>Why is this an issue?</h2>
<p>Using an empty class serves no purpose and can hinder the readability of the code.</p>
<pre>
class Foo {
  static bar() {
    // ...
  }
}
</pre>
<h2>How to fix it</h2>
<p>You can export the functions that you wish to make available.</p>
<pre>
export function bar()  {
  // ...
}
</pre>
<h3>Code examples</h3>
<h4>Noncompliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
class Foo { // Noncompliant
  static bar() {
    // ...
  }
}
</pre>
<h4>Compliant solution</h4>
<pre data-diff-id="1" data-diff-type="compliant">
export function bar() {
  // ...
}
</pre>
<h4>Noncompliant code example</h4>
<pre data-diff-id="2" data-diff-type="noncompliant">
class DoAndLog { // Noncompliant
  constructor () {
    console.log('I\'m done!');
  }
}
</pre>
<h4>Compliant solution</h4>
<pre data-diff-id="2" data-diff-type="compliant">
function doAndLog() {
  console.log('I\'m done!');
}
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://typescript-eslint.io/">typescript-eslint</a> - Rule <a
  href="https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-extraneous-class.mdx">no-extraneous-class</a> </li>
</ul>
